import uiautomation
from operator import methodcaller

# -------使用getattr()方法------------
s = 'abc123'
res = s.find('c')
print(res)
# 通过find字符串方法名调用
res = getattr(s, 'find')('c')
print(res)
"""
结果：与s.find()结果一直，都为2

"""
# -------使用operator库中的methodcaller方法------------
s = 'abc123'
res = s.find('c')
print(res)
res = methodcaller('find', 'c')(s)
print(res)
"""
结果：与s.find()结果一直，都为2

"""

# wd = uiautomation.ComboBoxControl(ClassName='11234')
res = methodcaller('ComboBoxControl', ClassName='11234')(uiautomation)
print(res)
